//
//  ViewController.swift
//  数据库
//
//  Created by Summer on 2017/12/25.
//  Copyright © 2017年 Summer. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        print(CZSQLiteManager.shared)
        
        let array = [["idstr": "101", "text": "微博101啊啊啊"],
                     ["idstr": "102", "text": "微博102"],
                     ["idstr": "103", "text": "微博103"],
                     ["idstr": "104", "text": "微博104"],
                     ["idstr": "105", "text": "微博105"],
                     ["idstr": "106", "text": "微博106"],
                     ["idstr": "107", "text": "微博107"],
                     ["idstr": "108", "text": "微博108"],
                     ["idstr": "109", "text": "微博109"],
                     ["idstr": "110", "text": "微博110"],
                     ["idstr": "111", "text": "微博111"],
                     ["idstr": "112", "text": "微博112"],
                     ["idstr": "113", "text": "微博113"],
                     ["idstr": "114", "text": "微博114"],
                     ["idstr": "115", "text": "微博115"],
                     ["idstr": "116", "text": "微博116"],
                     ["idstr": "117", "text": "微博117"],
                     ["idstr": "118", "text": "微博118"],
                     ["idstr": "119", "text": "微博119"],
                     ["idstr": "120", "text": "微博120"],
        ]
        
        CZSQLiteManager.shared.updateStatus(userId: "1", array: array)
        
        // --- 测试查询 ---
        let rs = CZSQLiteManager.shared.execRecordSet(sql: "SELECT statusId, userId, status FROM T_status")
        print(rs)
        
        // --- 测试默认 ---
        let defaultResult = CZSQLiteManager.shared.loadStatus(userId: "1", since_id: 0, max_id: 0)
        print(defaultResult)
        
        // --- 测试下拉 ---
        let upResult = CZSQLiteManager.shared.loadStatus(userId: "1", since_id: 115, max_id: 0)
        print(upResult)
        
        // --- 测试上拉 ---
        let downResult = CZSQLiteManager.shared.loadStatus(userId: "1", since_id: 0, max_id: 105)
        print(downResult)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

